<template>
  <div class="box">
    <div @click="gotodetail">
      <img :src="item.pic" alt="" />
      <p>{{ item.old_price }}</p>
      <button @click="remove">del</button>
    </div>
  </div>
</template>

<script>
export default {
  props: ["item"],
  data() {
    return {};
  },
  mounted() {},
  methods: {
    remove() {
      this.$emit("removes", this.item._id);
    },
    gotodetail() {
      this.$router.push({ path: "/detail", query: { item: this.item } });
      //json传参传item 商品数据
      // 接口传id
    },
  },
  components: {},
};
</script>

<style lang="scss">
.box {
  width: 49vw;
  height: 150px;
  display: inline-block;
  border: 1px solid rebeccapurple;
  img {
    width: 100%;
  }
}
</style>
